package com.cmseducation.controller;

import com.cmseducation.entity.CrmBanner;
import com.cmseducation.service.ICrmBannerService;
import com.cmseducation.utils.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 首页banner表 前端控制器
 * </p>
 *
 * @author Mr.tang
 * @since 2022-05-14
 */
@CrossOrigin
@RestController
@RequestMapping("/crmbanner")
public class CrmBannerController {

    @Autowired
    private ICrmBannerService iCrmBannerService;

    /*
    *  查询banner
    * */
    @Cacheable(value = "banner",key = "'banner'")
    @GetMapping("getbanner")
    public R getBanner(){
        List<CrmBanner> banner = iCrmBannerService.getBanner();
        return R.ok().data("banner",banner);
    }


}
